function logFile(filename, content, permission, bAddNewLine)

if nargin < 3, permission = 'a'; end
if nargin < 4, bAddNewLine = false; end

fileID = fopen(filename, permission);
fprintf(fileID, content);
if bAddNewLine, fprintf(fileID, '\n'); end
fclose(fileID);
